package com.example.week1.mvp.view;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;

import com.example.mylibrary.mvp.view.BaseActivity;
import com.example.week1.LoginActivity;
import com.example.week1.R;
import com.example.week1.mvp.contrat.RegisterContrat;
import com.example.week1.mvp.model.RegisterModel;
import com.example.week1.mvp.presenter.RegisterPresenter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class RegisterActivity extends BaseActivity<RegisterPresenter> implements RegisterContrat.RegisterView {
    @BindView(R.id.et1)
    EditText et1;
    @BindView(R.id.et2)
    EditText et2;
    @BindView(R.id.et3)
    EditText et3;
    @BindView(R.id.bt)
    Button bt;

    @Override
    public int bondLayout() {
        return R.layout.activity_register;
    }


    @Override
    public void initView() {

    }

    @Override
    public void inJect() {
        mPresenter = new RegisterPresenter(new RegisterModel(), this);
    }

    @Override
    public void initData() {

    }


    @Override
    public String getUsername() {
        return et1.getText().toString().trim();
    }

    @Override
    public String getpwd() {
        return et2.getText().toString().trim();
    }

    @Override
    public String getrepwd() {
        return et3.getText().toString().trim();
    }

    @Override
    public void goLogin() {
        Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
        intent.putExtra("s",getUsername());
        intent.putExtra("s1",getpwd());
        startActivity(intent);
    }


    @OnClick(R.id.bt)
    public void onViewClicked() {
        mPresenter.register();
    }


    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }


}
